#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "hmimodule.h"
#include "plcmodule.h"

QT_BEGIN_NAMESPACE
namespace Ui
{
class MainWindow;
}
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private:
    QObject* getCurrentModule();
    QString getFileFilter(QObject* module);
    bool fileOperation(QObject* module, const QString& fileName, bool isOpen);

private slots:
    void appendLog(const QString& message);
    void onNewFile();
    void onOpenFile();
    void onSaveFile();
    void startSimulation();
    void stopSimulation();

private:
    Ui::MainWindow *ui_;
    HMIModule* hmi_;
    PlcModule* plc_;
    ModbusManager* modbusManager_;
};

#endif // MAINWINDOW_H
